package cn.worken.baseframe.api.controller;

import cn.worken.baseframe.api.bean.request.QueryDemoReq;
import cn.worken.baseframe.api.bean.response.QueryDemoRes;
import cn.worken.baseframe.bean.dto.QueryDemoDTO;
import cn.worken.baseframe.facade.bo.DemoBO;
import cn.worken.baseframe.facade.facade.IDemoFacade;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author genxin.liu
 * @since 2021/12/27 15:07
 */
//@RestController
@RequestMapping("/demo")
public class DemoController {
    
    @Autowired
    private IDemoFacade demoFacade;
    
    @GetMapping("")
    public List<QueryDemoRes> queryDemoList(QueryDemoReq req) {
        QueryDemoDTO queryDemoDTO = req.convert();
        List<DemoBO> demoBOList = demoFacade.queryDemoList(queryDemoDTO);
        return QueryDemoRes.copyList(demoBOList);
    }
}
